<template>
  <el-dialog
    :visible.sync="state.visible"
    :fullscreen="fullscreen"
    :custom-class="!fullscreen ? 'custom-height' : 'custom-fullscreen'"
    :close-on-click-modal="false"
    :show-close="false"
    width="60%"
    :append-to-body="true"
    @closed="close"
  >
    <el-row slot="title" type="flex">
      <el-col :span="20">{{ title }}</el-col>
      <el-col :sm="8" :span="4" style="text-align: right">
        <svg-icon
          :icon-class="!fullscreen ? 'fullscreen' : 'exit-fullscreen'"
          style="cursor: pointer; margin-right: 10px"
          @click="
            () => {
              fullscreen = !fullscreen
            }
          "
        />
        <i class="el-icon-close" style="cursor: pointer" @click="close" />
      </el-col>
    </el-row>
    <el-form ref="dataForm" :model="form" label-position="right" label-width="100px">
      <el-row :gutter="18">
        <el-col :span="24">
          <el-col :span="24">
            <el-form-item
              label="商品编码"
              prop="goodsCode"
              :rules="{
                required: true,
                message: '商品编码不能为空',
                trigger: 'blur',
                whitespace: true
              }"
            >
              <el-input v-model="form.goodsCode" placeholder="请输入商品编码" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="物料名称"
              prop="goodsName"
              :rules="{
                required: true,
                message: '物料名称不能为空',
                trigger: 'blur',
                whitespace: true
              }"
            >
              <el-input v-model="form.goodsName" placeholder="请输入物料名称" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="规格">
              <el-input v-model="form.specifications" placeholder="请输入规格" />
            </el-form-item>
          </el-col>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">
        取消
      </el-button>
      <el-button type="primary" :loading="state.confirmSubmit" :disabled="state.confirmSubmit" @click="onSubmit">
        确定
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
import form from '@/components/diboot/mixins/form'

export default {
  name: 'GoodsForm',
  mixins: [form],
  data() {
    return {
      baseApi: '/goods'
    }
  }
}
</script>
<style lang="scss" scoped></style>
